﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SimpleWebApi.EFCore.Migrations
{
    /// <inheritdoc />
    public partial class InitialCreate : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Api_User",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false, comment: "主键ID")
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    UserName = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "用户名", collation: "utf8mb4_unicode_ci"),
                    Password = table.Column<string>(type: "varchar(64)", maxLength: 64, nullable: false, comment: "密码，md5", collation: "utf8mb4_unicode_ci"),
                    type = table.Column<int>(type: "int", nullable: false),
                    CreateTime = table.Column<DateTime>(type: "datetime(0)", nullable: false, comment: "创建时间"),
                    UpdateTime = table.Column<DateTime>(type: "datetime(0)", nullable: false, comment: "更新时间")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Api_User", x => x.Id);
                })
                .Annotation("Relational:Collation", "utf8mb4_unicode_ci");

            migrationBuilder.CreateIndex(
                name: "IX_Api_User_UserName",
                table: "Api_User",
                column: "UserName",
                unique: true);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Api_User");
        }
    }
}
